home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 43 / Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso / -serious- / programming / arexx / rexxbgui / mclist.rexx < prev    next >
OS/2 REXX Batch file  |  1999-06-14  |  2KB  |  88 lines

  1. /* REXX script for rexxbgui.library: List example */
  2.  
  3. if ~show('l','rexxbgui.library') then do
  4.     if ~addlib('rexxbgui.library',0,-30) then do
  5.         exit(20)
  6.     end
  7.     else nop
  8. end
  9. else nop
  10.  
  11. call bguiopen() /* causes error 12 if it did not work */
  12. /* supply a second argument for a '0' return code instead of an ARexx
  13.    error */
  14.  
  15. signal on syntax /* important: bguiclose() MUST be called */
  16. signal on halt
  17. signal on break_c
  18.  
  19. esc='1B'x
  20. lf='0A'x
  21. cr='0D'x
  22. tab='09'x
  23. grspace.narrow=-1
  24. grspace.normal=-2
  25. grspace.wide=-3
  26.  
  27. lst.count=27
  28. lst.0='80%'tab'20%'
  29. do i=1 for lst.count
  30.     lst.i='Entry' i||tab||d2c(i+64)
  31. end
  32.  
  33. /* using ARexx feature: ,<newline> is translated to nothing */
  34. /* the || are essential - any added space will cause trouble */
  35. /* redefining the same ID makes previous buttons unaccessible */
  36. /* do not redefine winclose etc. */
  37.  
  38. g=bguivgroup(,
  39.     bguiinfo(,
  40.         'info',,'cbRexxBGUI-b: multi-column listviews',
  41.     )||bguilayout(LGO_FixMinHeight,1)||,
  42.     bguihgroup(,
  43.         bguivgroup(,
  44.             bguilistview('sslistv',,'LST','D',2 80 20)||setlsttoms(),
  45.         ,,'F','Single-select')||,
  46.         bguivgroup(,
  47.             bguilistview('mslistv',,'LST','D',2 90 10),
  48.         ,,'F','Multi-select'),
  49.     )||,
  50.     bguihgroup(,
  51.         bguivarspace(50)||,
  52.         bguibutton('quit','_Quit')||,
  53.         bguivarspace(50),
  54.     )||bguilayout(LGO_FixMinHeight,1),
  55. ,grspace.normal,grspace.normal)
  56.  
  57. call bguiset(obj.mslistv,,LISTV_MultiSelect,1)
  58.  
  59. a=bguiwindow('Listview DragNDrop',g,50,30,,arg(1))
  60.  
  61. if bguiwinopen(a)=0 then bguierror(12)
  62. id=0
  63. do while bguiwinwaitevent(a,'ID')~=id.winclose
  64.     select
  65.         when id=id.winactive then nop
  66.         when id=id.wininactive then nop
  67.         when id=id.quit then leave
  68.         when id=id.winclose then nop
  69.         otherwise nop
  70.     end
  71. end
  72. rc=0
  73.  
  74. syntax:
  75. if rc~=0 then say '+++ ['rc']' errortext(rc) 'at line' sigl
  76. call bguiclose()
  77. exit 0
  78.  
  79. break_c:
  80. halt:
  81. rc=0
  82. say '+++ Break at line' sigl
  83. signal syntax
  84.  
  85. setlsttoms:
  86. lst.0='90%'tab'10%'
  87. return ''
  88.